package com.xiongwei.prototype;

/**
 * @author XiongWei
 * @date 2023/12/18
 */
public class Sheep implements Cloneable{

    private String name;

    private int age;

    public Sheep friend;

    public Sheep(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Sheep{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    /**
     * 浅拷贝
     * @return
     */
    @Override
    public Sheep clone() {
        try {
            Sheep sheep = (Sheep) super.clone();
            return sheep;
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }
}
